package com.jackrain.nea.fc.dl.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;

/**
 * 入库通知
 * Mapper
 *
 * @author xuxinshuai
 * @create 2018/05/12
 */
@Mapper
public interface WmsPurOrderMapper {

    @Select("SELECT BILL_NO AS bill_no ," +
            " 'PO' as bill_type,"+
            " STATUS , "+
            "BILL_DATE AS bill_date ," +
            "DATE_IN AS date_in ," +
            "BILL_TYPE AS order_type," +
            "CP_C_SUPPLIER_ECODE  AS orig_ecode , " +
            "CP_C_STORE_ECODE AS dest_ecode," +
            "CP_C_STORE_ID AS wms_store_code  ,"+
            "REMARK AS remark , " +
            "'80' AS recive_status ," +
            "NOW() as write_time ," +
            "NULL AS recive_time," +
            "NULL AS recive_err_msg , " +
            "OWNERENAME AS owner_ename," +
            "OWNERNAME AS owner_name," +
            "CREATIONDATE AS creation_date," +
            "MODIFIERENAME AS modifier_ename ," +
            "MODIFIERNAME AS modifier_name ," +
            "MODIFIEDDATE AS modified_date , " +
            "NULL AS userdefine1 ," +
            "NULL AS userdefine2 ," +
            "NULL AS userdefine3, " +
            "NULL AS userdefine4," +
            "NULL AS userdefine5 " +
            "FROM  DL_B_PUR_ORDER a " +
            "WHERE ID IN ( #{ids} )")
    HashMap selectwmsordersql(String ids);


    @Select("SELECT PS_C_SKU_ECODE AS sku," +
            "QTY_BILL AS qty_bill," +
            "OWNERENAME AS owner_ename," +
            "OWNERNAME AS owner_name," +
            "CREATIONDATE AS creation_date," +
            "MODIFIERENAME AS modifier_ename ," +
            "MODIFIERNAME AS modifier_name ," +
            "MODIFIEDDATE AS modified_date , " +
            "OVER_ADD_QTY AS over_add_qty , " +
            "NULL AS userdefine1 ," +
            "NULL AS userdefine2 ," +
            "NULL AS userdefine3, " +
            "NULL AS userdefine4," +
            "NULL AS userdefine5 " +
            "FROM  DL_B_PUR_ORDER_ITEM a " +
            "WHERE  DL_B_PUR_ORDER_ID IN ( #{ids} )")
    List<HashMap> selectwmsordertimesql(String ids);


}
